dhcpv4: fix DNS server option
authorDavid Härdeman <[email protected]>
Fri, 12 Dec 2025 20:30:18 +0000 (21:30 +0100)
committerÁlvaro Fernández Rojas <[email protected]>
Sat, 13 Dec 2025 10:43:30 +0000 (11:43 +0100)
The iface->dhcpv4_own_ip struct is not a struct in_addr, so change the
code so that the iov takes the actual IPv4 address.

Closes: https://github.com/openwrt/odhcpd/issues/344
Signed-off-by: David Härdeman <[email protected]>
Link: https://github.com/openwrt/odhcpd/pull/345
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
src/dhcpv4.c

index 31ef1e5f3da8dd9722b25a6a96ef5ccb01d64975..6dbc61d43ac3cc7789c0e031e4fa05e86203206c 100644 (file)
@@ -1119,8 +1119,8 @@ void dhcpv4_handle_msg(void *src_addr, void *data, size_t len,
                                reply_dnsserver.len = iface->dns_addrs4_cnt * sizeof(*iface->dns_addrs4);
                                iov[IOV_DNSSERVER_ADDRS].iov_base = iface->dns_addrs4;
                        } else {
-                               reply_dnsserver.len = sizeof(iface->dhcpv4_own_ip);
-                               iov[IOV_DNSSERVER_ADDRS].iov_base = &iface->dhcpv4_own_ip;
+                               reply_dnsserver.len = sizeof(iface->dhcpv4_own_ip.addr.in);
+                               iov[IOV_DNSSERVER_ADDRS].iov_base = &iface->dhcpv4_own_ip.addr.in;
                        }
                        iov[IOV_DNSSERVER_ADDRS].iov_len = reply_dnsserver.len;
                        break;